<template>
	<view class="wrapper">
		
		
		<view class="record">
			<text  class="tab" :class="cunt == index? 'nac':''" v-for="(item,index) in tab" :key='index' @tap="infos(index)">
				{{item}}
			</text>
			
			<view v-if="cunt == 0" class="zhuanzhang set_border" v-for="(val,index) in consumeRecordList" :key="'info1-'+index">
				<view class="aside_top">
					<view class="left">{{val.desc}}</view>
					<view class="right reduce">
						<!-- <text>-</text> -->
						{{val.money | toTwo(4)}} 
					</view>
				</view>
				<view class="aside_bot">
					<view class="date">{{val.time | time}}</view>
				</view>
			</view>
			
			<view v-if="cunt == 1" class="zhuanzhang set_border" v-for="(val,index) in consumeRecordLists" :key="'info2-'+index">
				<view class="aside_top">
					<view class="left">{{val.desc}}</view>
					<view class="right reduce">
						<!-- <text>-</text> -->
					
						{{val.total_mined | toTwo(4)}}
					</view>
				</view>
				<view class="aside_bot">
					<!--  -->
					<view class="date">{{` ${val.start_time.substr(4,2)}-${val.start_time.substr(6,2)} ${val.start_time.substr(8,2)}:${val.start_time.substr(10,2)}`}}</view>
				</view>
			</view>
			
			
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			pageIndex:0,
			consumeRecordList:[],
				consumeRecordLists:[],
			tab:['钱包明细','挖矿明细'],
			cunt:0,
			
		};
	},
	onShow() {
		this.pageIndex=0
		this.consumeRecordList=[]
		this.getMoney();
	},
	onReachBottom() {
		this.pageIndex++
		this.getMoney()
	},
	methods: {
		getMoney() {
			this.$ajax(this.apiList.consumeRecord,{
				pageIndex:this.pageIndex,
				pageSize:20
			}).then(res => {
				this.consumeRecordList =this.consumeRecordList.concat(res.data.pageData) 
			});
			this.$ajax(
			'/bi/getMineMining',
			{
			userId:uni.getStorageSync('userinfo').userId
			},
			'POST'
			).then(res=>{
			this.consumeRecordLists = res.data
			console.log(res)
			})
			
			
			
		},
		infos(index){
			this.cunt = index
		},
	}
};
</script>

<style>
.wrapper {
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	background-color: #0E1B45;
}

.record {
	width: 720rpx;
	right: 0;
}

.zhuanzhang {
	height: 140rpx;
}

.set_border {
	border-bottom: 1px solid #20D6D9;
}

.aside_top {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	font-size: 30rpx;
	font-weight: 500;
	color: rgba(51, 51, 51, 1);
	padding-top: 29rpx;
}

.aside_bot {
	display: flex;
	flex-direction: row;
	font-size: 26rpx;
	font-weight: 500;
	color: rgba(153, 153, 153, 1);
	margin-top: 21rpx;
}
.left{
	color: #FFF;
}
.right {
	margin-right: 23rpx;
	color: #fff;
}

.date {
	margin-right: 10rpx;
}

.plus {
	color: #ffa61e;
}
.tab{
	display: inline-block;
	width: 47%;
	height: 44px;
	background-color: rgba(95,104,114,0.43);
	margin-top: 20upx;
	color: #fff;
	text-align: center;
	line-height: 44px;
}
.nac {
	background: #ff3a2f;
}
</style>
